PATCHVB ------- By Rick Esterling, Copyright 1994, All Rights Reserved PatchVB is FREEWARE. You may modify and use it as you find fit, but it may not be resold or used in any way to make a profit. If you do use it, some credit would be appreciated. You are encouraged to send your comments/suggestions to: Rick Esterling Three Cruse Alley Huntsville, AL 35801 205-536-8568 Internet: esterra@widget.msfc.nasa.gov CIS: 73322,702 (I hang out in the MSBASIC forum daily) WHAT IT DOES ------------ I've heard several people say that they don't like the default action that VB programs take when they are exectued from the DOS command line. For those of you that have never tried it, VB programs don't just report "This program requires Microsoft Windows" and exit as do 99% of the other Windows programs. Rather, it tries to invoke Windows and then exectutes your program at startup. I personally prefer it to just respond as other Windows programs do, so I wrote this patch. HOW IT WORKS ------------ PatchVB simply reads an EXE file and tries to determine whether or not the file is a Visual Basic program. It does this by searching for the part of the stub in the EXE that files off Windows. If it finds the stub, it simply renames the call to Win.com to an invalid filename (a backslant and two NUL characters (ASCII 255). That way, when your VB EXE tries to launch Windows, it cannot find WIN.COM so it gracefully exits. AN EXTRA TRICK -------------- VB uses its own stub to create the stub of any EXEs that it compiles. This means if you patch VB.EXE itself, then all the programs that you compile thereafter will automatically include this patch and will not need further attention. DISCLAIMER ---------- As is the case with any program that modifies your executable files, great caution should be used before you try PatchVB on any of your programs. ALWAYS MAKE BACKUPS BEFORE APPLYING THIS PATCH! As you can see from the source code, PatchVB doesn't do anything "blindly". It tries to convince itself as much as it can that it's about to do the right thing, but just in case, make a backup, ok? FOR FUTURE REFERENCE -------------------- If you use PatchVB on any of your programs and then decide later that you want to restore the original stub, you should be able to very easily reverse engineer PatchVB since the source code is included. PatchVB itself can detect when a program has already had the patch applied, so all you would need to do is change that part to reinsert the correct filename that PatchVB originally renamed as described above. If you can't get it going, let me know (via one of the addresses shown at the top of this document) and I will provide you with a program to restore the original stub. Happy patching, Rick Esterling 12 Feb 94